
package com.alm.token.ui.activity;

import android.support.v4.app.Fragment;
import com.alm.token.R;
import com.alm.token.common.OnBackListener;

/**
 * 加上返回监听拦截
 */
public class FragmentBackHolderActivity extends FragmentHolderActivity {

    @Override
    public void onBackPressed() {
        Fragment f = getSupportFragmentManager().findFragmentById(R.id.fragmentHolderActivity_container_fl);
        if (f != null) {
            if (f instanceof OnBackListener) {
                OnBackListener onBackListener = (OnBackListener) f;
                onBackListener.onBack();
            } else {
                super.onBackPressed();
            }
        }
    }
}
